package com.infinova.datax.common.http;

import java.lang.reflect.Type;

/**
 * @author bigbird-0101
 * @date 2023-07-24 09:30
 */
public interface HttpClient {
    /**
     * 处理http请求
     * @param httpRequest httpRequest http请求
     * @param responseClazz responseClazz 响应体Clazz
     * @return 请求响应
     */
    default <T> T handle(HttpRequest httpRequest,Class<T> responseClazz){
        return handle(httpRequest,(Type)responseClazz);
    }
    /**
     * 处理http请求
     * @param httpRequest httpRequest http请求
     * @param responseType responseType 响应体Clazz
     * @return 请求响应
     */
    <T> T handle(HttpRequest httpRequest, Type responseType);

    /**
     * 销毁这个客户端
     */
    default void destroy(){

    }
}
